<?php

namespace app\admin\model;

use think\Model;


class Miner extends Model
{

    

    

    // 表名
    protected $name = 'miner';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'miner_cat_text',
        'miner_type_text'
    ];
    

    
    public function getMinerCatList()
    {
        return ['1' => __('Miner_cat 1'), '2' => __('Miner_cat 2')];
    }


    public function getMinerCatTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['miner_cat']) ? $data['miner_cat'] : '');
        $list = $this->getMinerCatList();
        return isset($list[$value]) ? $list[$value] : '';
    }

    public function getMinerTypeList()
    {
        return ['1' => __('Miner_type 1'), '2' => __('Miner_type 2'), '3' => __('Miner_type 3'),'4' => __('Miner_type 4'),];
    }


    public function getMinerTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['miner_type']) ? $data['miner_type'] : '');
        $list = $this->getMinerTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


}
